package model.geometry;

/**
 * Created by andreas on 19.04.14.
 */
public class AbstractDrawer {

    public String drawAsterix(int n) {

     return drawRecursive(n, "*", "");
    }

    public String drawWhitespaces(int n) {
        if (n < 0) {
            throw new IllegalArgumentException("can't draw " + n + " whitespaces. n bust be >= 0");
        }
        return drawRecursive(n, " ", "");
    }

    private String drawRecursive(int n, String character, String accumulator) {
        if (n == 0) {
            return accumulator;
        } else {
            return drawRecursive(n-1, character, accumulator + character);
        }
    }



}
